<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>



<script>

  /*
  function Person(name) {
    this.name = name
  }

  Person.prototype.sayHi = function () {
    console.log(`Hello ${this.name}!!!`)
  }
  */

 /* const fn = function f() {

  }
*/
  const Per = class Person {
    constructor(name) {
      // console.log(Person)
      this.name = name
    }
    // color = 'red'
    get val() {
      return this.name
    }

    set val(data) {
      this.name = data
      // console.log(data)
      return this.name
    }

    static sayHi() {
      console.log(`Hello ${this}!!!`)
    }
  }

  // Person.sayHi()

  class MyPerson extends Per{
    constructor(name, color) {
      super(name) //表示父类
      this.color = color
    }
  }


  // MyPerson.sayHi()

  let p1 = new Per('张三')
  let p2 = new MyPerson('李四', 'yellow')
  console.log(p1)
  console.log(p2)

  /*
  * var
  * let
  * const
  * function
  * class
  *
  * import
  *
  * */



  // console.log(p1 instanceof Per)
  // console.log(p1 instanceof MyPerson)

  // console.log(p2 instanceof MyPerson)
  // console.log(p2 instanceof Per)

  // console.log(p1.val)
  // p1.sayHi()


  // let p1 = new Person('张三')
  // console.log(p1.val)
  // p1.val = 'zhangsan'
  // console.log(p1)


  // console.log(Person.prototype)
  // console.log(p1)
  // p1.sayHi()

  // console.log(typeof Person)
  // console.log(Person === Person.prototype.constructor)




  // console.log(p1.__proto__)
  // console.log(p1)
  // p1.sayHi()
  // console.log(Person.prototype)
  // console.log(Person.prototype.constructor)







</script>

</body>
</html>